import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-14
 * Time: 00:22
 */
public class binary {
    //获取一个数二进制序列中所有的偶数位和奇数位， 分别输出二进制序列
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int sum = in.nextInt();
        for (int i = 31; i >= 0; i = i - 2) {
            int a = (sum >> i) & 1;
            System.out.print(a+" ");
        }
        System.out.println();
        for (int i = 30; i >= 0; i = i - 2) {
            int a = (sum >> i) & 1;
            System.out.print(a+" ");
        }
    }
}
